package com.mall.service.marketing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.model.domain.SmsFlashPromotionProductRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SmsFlashPromotionProductRelationMapper extends BaseMapper<SmsFlashPromotionProductRelation> {

    //根据flashPromotionId和每个时段的id查询出对应的商品数量
    @Select("SELECT\n" +
            "  COUNT(flash_promotion_session_id)\n" +
            "FROM\n" +
            "  `sms_flash_promotion_product_relation`\n" +
            "WHERE flash_promotion_id = #{flashPromotionId}\n" +
            "  AND flash_promotion_session_id = #{id}")
    Integer countProductCount(Integer flashPromotionId, Long id);


}
